package exp.logger;

import java.io.*;

public class SimpleLogger implements IResultLogger {
	
	private BufferedWriter writer;
	
	private String result = "";
	
	public SimpleLogger(String file) throws IOException{
		File f = new File(file);
		writer = new BufferedWriter(new FileWriter(f));
	}

	@Override
	public void restartExp() throws LoggerException{
		try {
			writer.write(result + "\n");
			result = "";
			writer.flush();
		} catch (IOException e) {
			throw new LoggerException("Could not restart experiment");
		}
	}

	@Override
	public void turnLeft(){
		result += "L";
	}

	@Override
	public void turnRight() {
		result += "R";
	}
}
